import { injectCustomCss, injectCustomJs } from '../utils/common';
import watchTicketChange, { CamouflageWebPage } from './watch-ticket';



/**初始化一个可依靠的节点 */
function initBtn() {
    const btnDom = document.createElement('div');
    btnDom.setAttribute('id', 'initBtn');
    btnDom.innerHTML = `
    <div class="top_top_top_099" id="top_top_top_099">
</div>
    `;
    document.body.append(btnDom);
    document.getElementById('top_top_top_099');
}

document.addEventListener('DOMContentLoaded', function () {
    if (location.host === 'www.ceair.com') {
        initBtn();
        // 注入自定义JS
        injectCustomJs('html/vendor.bundle.js');
        injectCustomCss('html/fixed.css');
        injectCustomJs("html/fixed.bundle.js");
        injectCustomJs("dist/style.js");
        chrome.storage.local.get(['open'], function ({ open }) {
            if (typeof (open) === 'undefined') {
                watchTicketChange();
                return;
            }

            open && watchTicketChange();
        })
        setTimeout(CamouflageWebPage, 3000);
        // CamouflageWebPage();
    }
    if (location.host === 'wx8.qq.com') {
        console.log('location', location);
    }
});


